﻿package mortal.game.view.guide.guideUse
{
    import Message.Public.*;
    import extend.language.*;
    import flash.events.*;
    import flash.geom.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.cache.packCache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuideSpecialEquipUseWin extends GuideEquipUseWin
    {

        public function GuideSpecialEquipUseWin(param1:ILayer = null)
        {
            super(param1);
            return;
        }// end function

        override protected function updateData() : void
        {
            var _loc_1:int = 0;
            var _loc_3:PackPosTypeCache = null;
            _txtName.htmlText = _itemData.itemInfo.htmlName;
            var _loc_2:int = 0;
            switch(_itemData.itemInfo.category)
            {
                case EProp._EPropFashionClothesEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeClothes);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionWingEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeWing);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionWeaponEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeWeapon);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionFightSoulEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeFightSoul);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionFightMethodEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeFightMethod);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionDragonSoulEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeDragonSoul);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionHolyBookEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeHolyBook);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionWarShieldEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeWarShield);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropFashionMonsterSoulEquip:
                {
                    _loc_3 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeMonsterSoul);
                    _myEquip = (_loc_3 as FashionPackCache).getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                case EProp._EPropMountEquip:
                {
                    _loc_3 = Cache.instance.pack.mountPackCache;
                    _myEquip = (_loc_3 as MountPackCache).getEquipByType(_itemData.itemInfo.type);
                }
                case EProp._EPropPet2Equip:
                {
                    _myEquip = Cache.instance.pack.petBag.getEquipByType(_itemData.itemInfo.type);
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (_myEquip != null)
            {
                _loc_2 = MountUtil.getMountEquipCombatByItemData(_myEquip);
                _txtEquipName.htmlText = Language.getStringByParam(20999, ItemsUtil.getItemWholeName(_myEquip, true));
            }
            else
            {
                _txtEquipName.htmlText = Language.getStringByParam(20999, Language.getString(21000));
            }
            _loc_1 = MountUtil.getMountEquipCombatByItemData(_itemData);
            if (_myEquip != null && _loc_1 > _loc_2)
            {
                _txtAdd.text = (_loc_1 - _loc_2).toString();
                _txtDesc.text = Language.getString(21003);
            }
            else
            {
                _txtAdd.text = _loc_1.toString();
                _txtDesc.text = Language.getString(21005);
            }
            _item.updateStrengLevel(_itemData.itemInfo.itemLevel);
            return;
        }// end function

        override protected function useItemHandler(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            var _loc_3:Object = {};
            switch(_itemData.itemInfo.category)
            {
                case EProp._EPropMountEquip:
                {
                    _loc_2 = ModuleType.Players;
                    _loc_3 = new Object();
                    _loc_3.putonitemData = _itemData;
                    _loc_3.getoffItemData = Cache.instance.pack.mountPackCache.getEquipByType(_itemData.itemInfo.type);
                    Dispatcher.dispatchEvent(new DataEvent(EventName.MountEquip, _loc_3));
                    break;
                }
                case EProp._EPropPet2Equip:
                {
                    _loc_2 = ModuleType.Players;
                    _loc_3 = new Object();
                    _loc_3.putonitemData = _itemData;
                    _loc_3.getoffItemData = Cache.instance.pack.petBag.getEquipByType(_itemData.itemInfo.type);
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetEquip, _loc_3));
                    break;
                }
                default:
                {
                    _loc_2 = ModuleType.Players;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FashionDressFashionEquip, _itemData));
                    break;
                    break;
                }
            }
            var _loc_4:* = _item.localToGlobal(GameConst.yellowPoint);
            FlyToNavbarTool.flyBitmapOriginalToPack(_item.bitmapdata, _loc_4, _loc_2);
            this.hide();
            return;
        }// end function

    }
}
